const Router = require('koa-router')
const {verifyAuth} = require('../middleware/auth.middleware')
const {verifyApply} = require('../middleware/friend.middleware')
const {
  applyAdd,
  applyList,
  agree,
  friendList,
  remove,
  rename
} = require('../controller/friend.controller')

const friendRouter = new Router({prefix: '/friend'})

// 申请添加好友
friendRouter.post('/apply', verifyAuth, verifyApply, applyAdd)
// 获取好友申请列表
friendRouter.get('/applylist', verifyAuth, applyList)
// 同意好友申请
friendRouter.post('/agree', verifyAuth, agree)
// 获取好友列表
friendRouter.get('/friendlist', verifyAuth, friendList)
// 拒绝申请、删除好友
friendRouter.post('/delete', verifyAuth, remove)
// 修改好友备注
friendRouter.post('/rename', verifyAuth, rename)

module.exports = friendRouter